﻿using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.ComponentModel.DataAnnotations.Schema;
using Tpl.Domain.Entities;

namespace Tpl.Domain.Config
{
    public class AuthorConfig : EntityTypeConfiguration<Author, string>
    {
        public override void Configure(EntityTypeBuilder<Author> builder)
        {
            base.Configure(builder);

            builder.Property(x => x.Name).HasMaxLength(50);
            //mock一条数据
            builder.HasData(new Author()
            {
                Id = Guid.NewGuid().ToString("N"),
                Name = "Bruce",
                Birthday = DateTime.Parse("1996-08-24 18:23:45")
            });
        }
    }
}
